home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / INTERNET / SITES / GRAHAM / XA_6S.ZIP / SOURCE / OBJECTS.SRC / BOXTEXT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-11  |  2.7 KB  |  112 lines

  1. /*
  2.  * XaAES - XaAES Ain't the AES
  3.  *
  4.  * A multitasking AES replacement for MiNT
  5.  *
  6.  */
  7.  
  8. #include <stdlib.h>
  9. #include <osbind.h>
  10. #ifdef LATTICE
  11. #undef abs        /* MiNTlib (PL46) #define is buggy! */
  12. #define abs(i)    __builtin_abs(i)
  13. #endif
  14. #include "XA_DEFS.H"
  15. #include "XA_TYPES.H"
  16. #include "XA_GLOBL.H"
  17. #include "K_DEFS.H"
  18. #include "RECTLIST.H"
  19. #include "BOX3D.H"
  20. #include "objects.h"
  21.  
  22. /*
  23.     Draw a boxtext object
  24. */
  25.  
  26. void d_g_boxtext(ODC_PARM *odc_p)
  27. {
  28.     OBJECT *ob=odc_p->tree + odc_p->object;
  29.     GRECT gr;
  30.     short parent_x=odc_p->parent_x, parent_y=odc_p->parent_y;
  31.     OBJC_COLORWORD *colourword;
  32.     TEDINFO *textblk;
  33.     unsigned short zap;
  34.     short coords[4],selected=ob->ob_state&SELECTED;
  35.     short border_thick=0;
  36.  
  37.     textblk=(TEDINFO*)ob->ob_spec;
  38.     colourword=(OBJC_COLORWORD*)&zap;
  39.     gr=set_text(ob, colourword, &border_thick, parent_x, parent_y);
  40.  
  41.     shadow_object(ob, parent_x, parent_y, colourword, border_thick);
  42.     set_colours(ob, colourword);
  43.  
  44.     switch(textblk->te_just)
  45.     {
  46.         case 0:
  47.             gr.g_x=parent_x+ob->ob_x;
  48.             break;
  49.         case 1:
  50.             gr.g_x=parent_x+ob->ob_x+ob->ob_width;
  51.             break;
  52.         case 2:
  53.             gr.g_x=parent_x+ob->ob_x+(ob->ob_width/2);
  54.             break;
  55.     }
  56.     
  57.     if (ob->ob_flags&FLD3DANY)
  58.     {
  59.         XA_3D_pushbutton(parent_x+ob->ob_x-1, parent_y+ob->ob_y-1, ob->ob_width+1, ob->ob_height+1, selected);
  60.         if (selected)
  61.         {
  62.             gr.g_x+=PUSH3D_DISTANCE; gr.g_y+=PUSH3D_DISTANCE;
  63.         }
  64.         vswr_mode(V_handle, colourword->opaque ? MD_REPLACE:MD_TRANS);
  65.         v_gtext(V_handle,gr.g_x,gr.g_y,textblk->te_ptext);
  66.     }else{
  67. /*        if (colourword->opaque)*/
  68.         {
  69.             coords[0]=parent_x+ob->ob_x;
  70.             coords[1]=parent_y+ob->ob_y;
  71.             coords[2]=coords[0]+ob->ob_width-1;
  72.             coords[3]=coords[1]+ob->ob_height-1;
  73.             v_bar(V_handle, coords);
  74.         }
  75.                 
  76.         vswr_mode(V_handle, colourword->opaque ? MD_REPLACE:MD_TRANS);
  77.         v_gtext(V_handle,gr.g_x,gr.g_y,textblk->te_ptext);
  78.  
  79.         if (selected)
  80.         {
  81.             coords[0]=parent_x+ob->ob_x;
  82.             coords[1]=parent_y+ob->ob_y;
  83.             coords[2]=coords[0]+ob->ob_width-1;
  84.             coords[3]=coords[1]+ob->ob_height-1;
  85.             vswr_mode(V_handle,MD_XOR);
  86.             vsf_color(V_handle,BLACK);
  87.             vsf_interior(V_handle,FIS_SOLID);
  88.             v_bar(V_handle, coords);
  89.         }
  90.  
  91.         if (border_thick)    /* Display a border? */
  92.         {
  93.             vswr_mode(V_handle, MD_REPLACE);
  94.             draw_2d_box(parent_x+ob->ob_x, parent_y+ob->ob_y, 
  95.                         ob->ob_width, ob->ob_height, 
  96.                         border_thick, colourword->borderc);
  97.         }
  98.     }
  99.     
  100.     if (ob->ob_state&IS_EDIT)
  101.     {
  102.         coords[0]=parent_x+ob->ob_x+textblk->te_tmplen*gr.g_w;
  103.         coords[1]=parent_y+ob->ob_y;
  104.         coords[2]=coords[0]+gr.g_w-1;
  105.         coords[3]=coords[1]+gr.g_h-1;
  106.         vswr_mode(V_handle,MD_XOR);
  107.         vsf_color(V_handle,BLACK);
  108.         vsf_interior(V_handle,FIS_SOLID);
  109.         v_bar(V_handle, coords);
  110.     }
  111.  
  112. }